//给ul里面添加li元素

var oul = document.getElementById('oul');
var frg = document.createDocumentFragment();
for(var i = 0 ; i < data.length; i++){
    var li = document.createElement('li');
    for (var j = 0; j < 4; j++) {
        var span = document.createElement('span');
        if(j == 0){
            span.innerText = data[i].name;
            li.appendChild(span);
        }else if(j == 1){
            span.innerText = data[i].age;
            li.appendChild(span);
        }else if(j == 2){
            span.innerText = data[i].fight;
            li.appendChild(span);
        }else if(j == 3){
            span.innerText = data[i].sex;
            li.appendChild(span);
        }

        
        
    }
    
    frg.appendChild(li);
}

oul.appendChild(frg);

//给按钮绑定点击事件可以进行排序
const oliss = document.getElementsByTagName('li');
const olissArray = ultis.listToArray(oliss); 
var ageButton = document.getElementById('age');
ageButton.addEventListener('click',ultis.mySort);